package com.future.bantang.activity;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;

import com.future.bantang.R;
import com.future.bantang.adapter.AbsBaseAdapter;
import com.future.bantang.adapter.BaseAdapter;
import com.future.bantang.view.TitleBarView;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.List;

/**
 * work by liufujie
 * 这是一个用来显示所有热门商品评论的抽象activity
 */
@ContentView(R.layout.activity_all_commts)
public abstract class BaseAllCommtsActivity<T> extends BaseActivity {

    //控件集合
    @ViewInject(R.id.tbv_back)
    private TitleBarView tbvBack;

    @ViewInject(R.id.lv_all_comments)
    private ListView lvAllComments;

    private ImageView ivBack;

    //存放数据集合
    public List<T> commentsList;

    /**
     * 初始化数据
     */
    @Override
    protected void init() {

        getAllComments();

        ivBack = tbvBack.getmIco();

        //结束此activity
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BaseAllCommtsActivity.this.finish();
            }
        });
    }

    /**
     * 对外提供一个抽象方法用来获取传入的数据
     * 一般用intent获得
     *
     * @return
     */
    public abstract List<T> getAllComments();

    /**
     * 加载数据
     */
    @Override
    protected void loadDatas() {

    }
}
